package com.chenchao.collection.properties;

import java.util.Properties;
import java.util.Set;

/**
 * @encoding : UTF-8
 * @Time : 2020/12/5 15:42
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.collection.properties.Test02.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 * properties特有方法
 */
public class Test02 {
    public static void main(String[] args) {
        Properties properties = new Properties();
        /*底层还是调用put方法，但是添加时指定了为String 类型*/
        properties.setProperty("key1","value1");
        properties.setProperty("key2","value2");
        properties.setProperty("key3","value3");
        properties.setProperty("key4","value4");
        /*获得不可修改的键集进行遍历*/
        final Set<String> strings = properties.stringPropertyNames();
        for (String string : strings) {
            System.out.println(string+":"+properties.getProperty(string));
        }
    }
}
